package com.test.springdata.service;

import com.test.springdata.entities.Person;
import com.test.springdata.repositories.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/10/30 16:43
 */
@Service
public class PersonService {
    @Autowired
    private PersonRepository personRepository;

    @Transactional
    public void updatePersonEmail(String email, Integer id) {
        personRepository.updatePersonEmail(id, email);
    }

    @Transactional
    public void savePersons(List<Person> persons) {
        personRepository.save(persons);
    }
}
